package com.bchun.gamepk.service.impl;

import java.io.Serializable;

import org.springframework.dao.DataAccessException;

import com.bchun.gamepk.dao.IBaseDao;
import com.bchun.gamepk.model.Page;
import com.bchun.gamepk.service.IBaseService;

/**
 * <pre>
 * FutureSoftware
 * 
 * File: BaseServiceImpl.java
 * 
 * Copyright (C) By PeterFeng at 2013
 * 
 * Description: 
 * 
 * Notes:
 * 
 * Revision History
 * Date          Name         Desc
 * 2013年9月21日         PeterFeng    Initial design
 * 
 * </pre>
 */
public abstract class BaseServiceImpl<T> implements IBaseService<T> {

	abstract protected IBaseDao<T> dao();

	@Override
	public void delete(T model) throws DataAccessException {
		dao().delete(model);
	}

	@Override
	public int deleteById(Object id) throws DataAccessException {
		return dao().deleteById(id);
	}

	@Override
	public Object insert(T model) throws DataAccessException {
		return dao().insert(model);
	}

	@Override
	public T getById(Class<T> cls, Serializable id) {
		return dao().getById(cls, id);
	}

	@Override
	public Page<T> selectByPage(Page<T> page) {
		return dao().selectByPage(page);
	}

	@Override
	public void update(T model) throws DataAccessException {
		dao().update(model);
	}

}
